home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
7_7.lha
/
7_7
/
7_7getnext.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
642b
|
40 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
/ Get the next entry from a list,
/ removing it afterwards.
/ curr is left alone.
nt dlist_iterator::getnext(ent &a)
if (!curr_dlist->last)
return 0;
// choose the link to remove
dlink *f;
if (curr)
if (curr == curr_dlist->last)
{
curr = 0;
return 0;
}
else
f = curr->next;
else
f = curr_dlist->last->next;
a = f->e;
// remove f from the list
if (f == curr_dlist->last)
curr_dlist->last = 0;
else
f->remove();
delete f;
return 1;